using System;
using System.Collections.Generic;
using System.Reflection;
using System.Runtime.InteropServices;

using ILRuntime.CLR.TypeSystem;
using ILRuntime.CLR.Method;
using ILRuntime.Runtime.Enviorment;
using ILRuntime.Runtime.Intepreter;
using ILRuntime.Runtime.Stack;
using ILRuntime.Reflection;
using ILRuntime.CLR.Utils;
using System.Linq;

namespace ILRuntime.Runtime.Generated
{
    unsafe class SevenZip_Compression_LZ_InWindow_Binding
    {
        public static void Register(ILRuntime.Runtime.Enviorment.AppDomain app)
        {
            BindingFlags flag = BindingFlags.Public | BindingFlags.Instance | BindingFlags.Static | BindingFlags.DeclaredOnly;
            MethodBase method;
            FieldInfo field;
            Type[] args;
            Type type = typeof(SevenZip.Compression.LZ.InWindow);
            args = new Type[]{};
            method = type.GetMethod("MoveBlock", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, MoveBlock_0);
            args = new Type[]{};
            method = type.GetMethod("ReadBlock", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, ReadBlock_1);
            args = new Type[]{typeof(System.UInt32), typeof(System.UInt32), typeof(System.UInt32)};
            method = type.GetMethod("Create", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, Create_2);
            args = new Type[]{typeof(System.IO.Stream)};
            method = type.GetMethod("SetStream", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, SetStream_3);
            args = new Type[]{};
            method = type.GetMethod("ReleaseStream", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, ReleaseStream_4);
            args = new Type[]{};
            method = type.GetMethod("Init", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, Init_5);
            args = new Type[]{};
            method = type.GetMethod("MovePos", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, MovePos_6);
            args = new Type[]{typeof(System.Int32)};
            method = type.GetMethod("GetIndexByte", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, GetIndexByte_7);
            args = new Type[]{typeof(System.Int32), typeof(System.UInt32), typeof(System.UInt32)};
            method = type.GetMethod("GetMatchLen", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, GetMatchLen_8);
            args = new Type[]{};
            method = type.GetMethod("GetNumAvailableBytes", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, GetNumAvailableBytes_9);
            args = new Type[]{typeof(System.Int32)};
            method = type.GetMethod("ReduceOffsets", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, ReduceOffsets_10);

            field = type.GetField("_bufferBase", flag);
            app.RegisterCLRFieldGetter(field, get__bufferBase_0);
            app.RegisterCLRFieldSetter(field, set__bufferBase_0);
            app.RegisterCLRFieldBinding(field, CopyToStack__bufferBase_0, AssignFromStack__bufferBase_0);
            field = type.GetField("_bufferOffset", flag);
            app.RegisterCLRFieldGetter(field, get__bufferOffset_1);
            app.RegisterCLRFieldSetter(field, set__bufferOffset_1);
            app.RegisterCLRFieldBinding(field, CopyToStack__bufferOffset_1, AssignFromStack__bufferOffset_1);
            field = type.GetField("_blockSize", flag);
            app.RegisterCLRFieldGetter(field, get__blockSize_2);
            app.RegisterCLRFieldSetter(field, set__blockSize_2);
            app.RegisterCLRFieldBinding(field, CopyToStack__blockSize_2, AssignFromStack__blockSize_2);
            field = type.GetField("_pos", flag);
            app.RegisterCLRFieldGetter(field, get__pos_3);
            app.RegisterCLRFieldSetter(field, set__pos_3);
            app.RegisterCLRFieldBinding(field, CopyToStack__pos_3, AssignFromStack__pos_3);
            field = type.GetField("_streamPos", flag);
            app.RegisterCLRFieldGetter(field, get__streamPos_4);
            app.RegisterCLRFieldSetter(field, set__streamPos_4);
            app.RegisterCLRFieldBinding(field, CopyToStack__streamPos_4, AssignFromStack__streamPos_4);


            app.RegisterCLRCreateDefaultInstance(type, () => new SevenZip.Compression.LZ.InWindow());
            app.RegisterCLRCreateArrayInstance(type, s => new SevenZip.Compression.LZ.InWindow[s]);

            args = new Type[]{};
            method = type.GetConstructor(flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, Ctor_0);

        }


        static StackObject* MoveBlock_0(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            StackObject* ptr_of_this_method;
            StackObject* __ret = ILIntepreter.Minus(__esp, 1);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
            SevenZip.Compression.LZ.InWindow instance_of_this_method = (SevenZip.Compression.LZ.InWindow)typeof(SevenZip.Compression.LZ.InWindow).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags)0);
            __intp.Free(ptr_of_this_method);

            instance_of_this_method.MoveBlock();

            return __ret;
        }

        static StackObject* ReadBlock_1(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            StackObject* ptr_of_this_method;
            StackObject* __ret = ILIntepreter.Minus(__esp, 1);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
            SevenZip.Compression.LZ.InWindow instance_of_this_method = (SevenZip.Compression.LZ.InWindow)typeof(SevenZip.Compression.LZ.InWindow).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags)0);
            __intp.Free(ptr_of_this_method);

            instance_of_this_method.ReadBlock();

            return __ret;
        }

        static StackObject* Create_2(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            StackObject* ptr_of_this_method;
            StackObject* __ret = ILIntepreter.Minus(__esp, 4);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
            System.UInt32 @keepSizeReserv = (uint)ptr_of_this_method->Value;

            ptr_of_this_method = ILIntepreter.Minus(__esp, 2);
            System.UInt32 @keepSizeAfter = (uint)ptr_of_this_method->Value;

            ptr_of_this_method = ILIntepreter.Minus(__esp, 3);
            System.UInt32 @keepSizeBefore = (uint)ptr_of_this_method->Value;

            ptr_of_this_method = ILIntepreter.Minus(__esp, 4);
            SevenZip.Compression.LZ.InWindow instance_of_this_method = (SevenZip.Compression.LZ.InWindow)typeof(SevenZip.Compression.LZ.InWindow).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags)0);
            __intp.Free(ptr_of_this_method);

            instance_of_this_method.Create(@keepSizeBefore, @keepSizeAfter, @keepSizeReserv);

            return __ret;
        }

        static StackObject* SetStream_3(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            StackObject* ptr_of_this_method;
            StackObject* __ret = ILIntepreter.Minus(__esp, 2);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
            System.IO.Stream @stream = (System.IO.Stream)typeof(System.IO.Stream).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags)0);
            __intp.Free(ptr_of_this_method);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 2);
            SevenZip.Compression.LZ.InWindow instance_of_this_method = (SevenZip.Compression.LZ.InWindow)typeof(SevenZip.Compression.LZ.InWindow).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags)0);
            __intp.Free(ptr_of_this_method);

            instance_of_this_method.SetStream(@stream);

            return __ret;
        }

        static StackObject* ReleaseStream_4(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            StackObject* ptr_of_this_method;
            StackObject* __ret = ILIntepreter.Minus(__esp, 1);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
            SevenZip.Compression.LZ.InWindow instance_of_this_method = (SevenZip.Compression.LZ.InWindow)typeof(SevenZip.Compression.LZ.InWindow).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags)0);
            __intp.Free(ptr_of_this_method);

            instance_of_this_method.ReleaseStream();

            return __ret;
        }

        static StackObject* Init_5(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            StackObject* ptr_of_this_method;
            StackObject* __ret = ILIntepreter.Minus(__esp, 1);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
            SevenZip.Compression.LZ.InWindow instance_of_this_method = (SevenZip.Compression.LZ.InWindow)typeof(SevenZip.Compression.LZ.InWindow).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags)0);
            __intp.Free(ptr_of_this_method);

            instance_of_this_method.Init();

            return __ret;
        }

        static StackObject* MovePos_6(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            StackObject* ptr_of_this_method;
            StackObject* __ret = ILIntepreter.Minus(__esp, 1);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
            SevenZip.Compression.LZ.InWindow instance_of_this_method = (SevenZip.Compression.LZ.InWindow)typeof(SevenZip.Compression.LZ.InWindow).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags)0);
            __intp.Free(ptr_of_this_method);

            instance_of_this_method.MovePos();

            return __ret;
        }

        static StackObject* GetIndexByte_7(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            StackObject* ptr_of_this_method;
            StackObject* __ret = ILIntepreter.Minus(__esp, 2);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
            System.Int32 @index = ptr_of_this_method->Value;

            ptr_of_this_method = ILIntepreter.Minus(__esp, 2);
            SevenZip.Compression.LZ.InWindow instance_of_this_method = (SevenZip.Compression.LZ.InWindow)typeof(SevenZip.Compression.LZ.InWindow).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags)0);
            __intp.Free(ptr_of_this_method);

            var result_of_this_method = instance_of_this_method.GetIndexByte(@index);

            __ret->ObjectType = ObjectTypes.Integer;
            __ret->Value = result_of_this_method;
            return __ret + 1;
        }

        static StackObject* GetMatchLen_8(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            StackObject* ptr_of_this_method;
            StackObject* __ret = ILIntepreter.Minus(__esp, 4);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
            System.UInt32 @limit = (uint)ptr_of_this_method->Value;

            ptr_of_this_method = ILIntepreter.Minus(__esp, 2);
            System.UInt32 @distance = (uint)ptr_of_this_method->Value;

            ptr_of_this_method = ILIntepreter.Minus(__esp, 3);
            System.Int32 @index = ptr_of_this_method->Value;

            ptr_of_this_method = ILIntepreter.Minus(__esp, 4);
            SevenZip.Compression.LZ.InWindow instance_of_this_method = (SevenZip.Compression.LZ.InWindow)typeof(SevenZip.Compression.LZ.InWindow).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags)0);
            __intp.Free(ptr_of_this_method);

            var result_of_this_method = instance_of_this_method.GetMatchLen(@index, @distance, @limit);

            __ret->ObjectType = ObjectTypes.Integer;
            __ret->Value = (int)result_of_this_method;
            return __ret + 1;
        }

        static StackObject* GetNumAvailableBytes_9(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            StackObject* ptr_of_this_method;
            StackObject* __ret = ILIntepreter.Minus(__esp, 1);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
            SevenZip.Compression.LZ.InWindow instance_of_this_method = (SevenZip.Compression.LZ.InWindow)typeof(SevenZip.Compression.LZ.InWindow).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags)0);
            __intp.Free(ptr_of_this_method);

            var result_of_this_method = instance_of_this_method.GetNumAvailableBytes();

            __ret->ObjectType = ObjectTypes.Integer;
            __ret->Value = (int)result_of_this_method;
            return __ret + 1;
        }

        static StackObject* ReduceOffsets_10(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            StackObject* ptr_of_this_method;
            StackObject* __ret = ILIntepreter.Minus(__esp, 2);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
            System.Int32 @subValue = ptr_of_this_method->Value;

            ptr_of_this_method = ILIntepreter.Minus(__esp, 2);
            SevenZip.Compression.LZ.InWindow instance_of_this_method = (SevenZip.Compression.LZ.InWindow)typeof(SevenZip.Compression.LZ.InWindow).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags)0);
            __intp.Free(ptr_of_this_method);

            instance_of_this_method.ReduceOffsets(@subValue);

            return __ret;
        }


        static object get__bufferBase_0(ref object o)
        {
            return ((SevenZip.Compression.LZ.InWindow)o)._bufferBase;
        }

        static StackObject* CopyToStack__bufferBase_0(ref object o, ILIntepreter __intp, StackObject* __ret, IList<object> __mStack)
        {
            var result_of_this_method = ((SevenZip.Compression.LZ.InWindow)o)._bufferBase;
            return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method);
        }

        static void set__bufferBase_0(ref object o, object v)
        {
            ((SevenZip.Compression.LZ.InWindow)o)._bufferBase = (System.Byte[])v;
        }

        static StackObject* AssignFromStack__bufferBase_0(ref object o, ILIntepreter __intp, StackObject* ptr_of_this_method, IList<object> __mStack)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            System.Byte[] @_bufferBase = (System.Byte[])typeof(System.Byte[]).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags)0);
            ((SevenZip.Compression.LZ.InWindow)o)._bufferBase = @_bufferBase;
            return ptr_of_this_method;
        }

        static object get__bufferOffset_1(ref object o)
        {
            return ((SevenZip.Compression.LZ.InWindow)o)._bufferOffset;
        }

        static StackObject* CopyToStack__bufferOffset_1(ref object o, ILIntepreter __intp, StackObject* __ret, IList<object> __mStack)
        {
            var result_of_this_method = ((SevenZip.Compression.LZ.InWindow)o)._bufferOffset;
            __ret->ObjectType = ObjectTypes.Integer;
            __ret->Value = (int)result_of_this_method;
            return __ret + 1;
        }

        static void set__bufferOffset_1(ref object o, object v)
        {
            ((SevenZip.Compression.LZ.InWindow)o)._bufferOffset = (System.UInt32)v;
        }

        static StackObject* AssignFromStack__bufferOffset_1(ref object o, ILIntepreter __intp, StackObject* ptr_of_this_method, IList<object> __mStack)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            System.UInt32 @_bufferOffset = (uint)ptr_of_this_method->Value;
            ((SevenZip.Compression.LZ.InWindow)o)._bufferOffset = @_bufferOffset;
            return ptr_of_this_method;
        }

        static object get__blockSize_2(ref object o)
        {
            return ((SevenZip.Compression.LZ.InWindow)o)._blockSize;
        }

        static StackObject* CopyToStack__blockSize_2(ref object o, ILIntepreter __intp, StackObject* __ret, IList<object> __mStack)
        {
            var result_of_this_method = ((SevenZip.Compression.LZ.InWindow)o)._blockSize;
            __ret->ObjectType = ObjectTypes.Integer;
            __ret->Value = (int)result_of_this_method;
            return __ret + 1;
        }

        static void set__blockSize_2(ref object o, object v)
        {
            ((SevenZip.Compression.LZ.InWindow)o)._blockSize = (System.UInt32)v;
        }

        static StackObject* AssignFromStack__blockSize_2(ref object o, ILIntepreter __intp, StackObject* ptr_of_this_method, IList<object> __mStack)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            System.UInt32 @_blockSize = (uint)ptr_of_this_method->Value;
            ((SevenZip.Compression.LZ.InWindow)o)._blockSize = @_blockSize;
            return ptr_of_this_method;
        }

        static object get__pos_3(ref object o)
        {
            return ((SevenZip.Compression.LZ.InWindow)o)._pos;
        }

        static StackObject* CopyToStack__pos_3(ref object o, ILIntepreter __intp, StackObject* __ret, IList<object> __mStack)
        {
            var result_of_this_method = ((SevenZip.Compression.LZ.InWindow)o)._pos;
            __ret->ObjectType = ObjectTypes.Integer;
            __ret->Value = (int)result_of_this_method;
            return __ret + 1;
        }

        static void set__pos_3(ref object o, object v)
        {
            ((SevenZip.Compression.LZ.InWindow)o)._pos = (System.UInt32)v;
        }

        static StackObject* AssignFromStack__pos_3(ref object o, ILIntepreter __intp, StackObject* ptr_of_this_method, IList<object> __mStack)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            System.UInt32 @_pos = (uint)ptr_of_this_method->Value;
            ((SevenZip.Compression.LZ.InWindow)o)._pos = @_pos;
            return ptr_of_this_method;
        }

        static object get__streamPos_4(ref object o)
        {
            return ((SevenZip.Compression.LZ.InWindow)o)._streamPos;
        }

        static StackObject* CopyToStack__streamPos_4(ref object o, ILIntepreter __intp, StackObject* __ret, IList<object> __mStack)
        {
            var result_of_this_method = ((SevenZip.Compression.LZ.InWindow)o)._streamPos;
            __ret->ObjectType = ObjectTypes.Integer;
            __ret->Value = (int)result_of_this_method;
            return __ret + 1;
        }

        static void set__streamPos_4(ref object o, object v)
        {
            ((SevenZip.Compression.LZ.InWindow)o)._streamPos = (System.UInt32)v;
        }

        static StackObject* AssignFromStack__streamPos_4(ref object o, ILIntepreter __intp, StackObject* ptr_of_this_method, IList<object> __mStack)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            System.UInt32 @_streamPos = (uint)ptr_of_this_method->Value;
            ((SevenZip.Compression.LZ.InWindow)o)._streamPos = @_streamPos;
            return ptr_of_this_method;
        }



        static StackObject* Ctor_0(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            StackObject* __ret = ILIntepreter.Minus(__esp, 0);

            var result_of_this_method = new SevenZip.Compression.LZ.InWindow();

            return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method);
        }


    }
}
